package com.cxc.kafka.demo.web;


import com.cxc.kafka.demo.service.KafkaMessageSendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class KafkaMessageSendController {
    @Autowired
    private KafkaMessageSendService kafkaMessageSendService;

    @GetMapping("/sendMsg")
    public void hello(@RequestParam(value = "message", defaultValue = "World") String message,
                      @RequestParam(value = "topic", defaultValue = "test") String topic) {
        kafkaMessageSendService.send(topic, message);
    }

}
